Skip to content

Update assets.md #647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update assets.md #647

wants to merge 1 commit into from

Conversation

AliAlkhtri
Copy link

INFURA_PROJECT_ID=your_project_id
INFURA_PROJECT_SECRET=your_project_secret
WALLET_PRIVATE_KEY=your_private_key_without_0x
WALLET_ADDRESS=your_wallet_address

⚠️ لا تشارك هذا الملف أبدًا. تأكد من أن المفتاح الخاص مشفر أو محفوظ بأمان.


📄 index.js – كود إرسال المعاملة عبر Infura (جاهز للتكامل مع MEV)

require('dotenv').config();
const Web3 = require('web3');

// الاتصال عبر Infura – endpoint عادي حاليًا، لاحقًا سيتم استبداله بـ private endpoint const web3 = new Web3(https://mainnet.infura.io/v3/${process.env.INFURA_PROJECT_ID});

const fromAddress = process.env.WALLET_ADDRESS;
const privateKey = process.env.WALLET_PRIVATE_KEY;

async function sendTransaction() {
const nonce = await web3.eth.getTransactionCount(fromAddress, 'latest');

const tx = {
from: fromAddress,
to: '0x000000000000000000000000000000000000dead', // عنوان تجريبي
value: web3.utils.toWei('0.001', 'ether'),
gas: 21000,
nonce: nonce,
chainId: 1, // mainnet
};

const signedTx = await web3.eth.accounts.signTransaction(tx, '0x' + privateKey);

try {
const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
console.log('✅ Transaction successful:', receipt.transactionHash);
} catch (error) {
console.error('❌ Transaction failed:', error.message);
}
}

sendTransaction();

INFURA_PROJECT_ID=your_project_id
INFURA_PROJECT_SECRET=your_project_secret
WALLET_PRIVATE_KEY=your_private_key_without_0x
WALLET_ADDRESS=your_wallet_address

> ⚠️ لا تشارك هذا الملف أبدًا. تأكد من أن المفتاح الخاص مشفر أو محفوظ بأمان.




---

📄 index.js – كود إرسال المعاملة عبر Infura (جاهز للتكامل مع MEV)

require('dotenv').config();
const Web3 = require('web3');

// الاتصال عبر Infura – endpoint عادي حاليًا، لاحقًا سيتم استبداله بـ private endpoint
const web3 = new Web3(`https://mainnet.infura.io/v3/${process.env.INFURA_PROJECT_ID}`);

const fromAddress = process.env.WALLET_ADDRESS;
const privateKey = process.env.WALLET_PRIVATE_KEY;

async function sendTransaction() {
  const nonce = await web3.eth.getTransactionCount(fromAddress, 'latest');

  const tx = {
    from: fromAddress,
    to: '0x000000000000000000000000000000000000dead', // عنوان تجريبي
    value: web3.utils.toWei('0.001', 'ether'),
    gas: 21000,
    nonce: nonce,
    chainId: 1, // mainnet
  };

  const signedTx = await web3.eth.accounts.signTransaction(tx, '0x' + privateKey);

  try {
    const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
    console.log('✅ Transaction successful:', receipt.transactionHash);
  } catch (error) {
    console.error('❌ Transaction failed:', error.message);
  }
}

sendTransaction();
@@ -105,4 +105,4 @@ complete the token transfer before BC fusion as much as possible.

The detailed guide for this solution will be published after the BC
Fusion.
Stay tuned for the update.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants